Public Class LineFreezePenaltyReport
    Inherits [lib].BasePage

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.


    Protected WithEvents txt_ValidFrom As System.Web.UI.WebControls.TextBox
    Protected WithEvents txt_ValidTo As System.Web.UI.WebControls.TextBox
    Protected WithEvents txt_Custcode As System.Web.UI.WebControls.TextBox
    Protected WithEvents btnAuthenticateCustomer As System.Web.UI.WebControls.Button
    Protected WithEvents Lblok As System.Web.UI.WebControls.Label
    Protected WithEvents ContentPaneFooter2 As Library.WebControls.ContentPaneFooter
    Protected WithEvents dgContracts As System.Web.UI.WebControls.DataGrid
    Protected WithEvents Label2 As System.Web.UI.WebControls.Label
    Protected WithEvents ProcessType As System.Web.UI.WebControls.RadioButtonList
    Protected WithEvents Dgall As System.Web.UI.WebControls.DataGrid

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object
    Protected WithEvents txtHiddenInfo As System.Web.UI.WebControls.TextBox

    'Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    '    'CODEGEN: This method call is required by the Web Form Designer
    '    'Do not modify it using the code editor.
    '    InitializeComponent()
    'End Sub

#End Region
    Dim isitinthemonth As Boolean

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.PageTitle = "Line Freeze Penalty Report"

    End Sub


    Private Sub btnAuthenticateCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAuthenticateCustomer.Click

            Dgall.EditItemIndex = -1
            Dgall.DataSource = Nothing
            Dgall.DataBind()
            Doldur()

    End Sub

    Private Sub Doldur()
        Dim sql As String
        Dim dt As DataTable

        sql = "select lff.is_penalty_given, lff.co_id, r.role_def as user_role, lff.bn_userid, lu.username, lff.msisdn, lff.fee_amount, lff.custcode CustomerCode, lff.pr_custcode PaymentResponsible, lff.create_date  from eu_bill.line_freeze_penalty_exc lff,       billintra.login_user            lu,        billintra.retention_roles r, billintra.retention_users ru where lff.bn_userid = lu.userid(+) and lff.bn_userid = ru.user_id(+)  and ru.role_id = r.role_id(+) "

        If Me.txt_Custcode.Text <> "" Then

            If Me.txt_ValidFrom.Text <> "" Then
                sql &= " and lff.custcode = '" & Me.txt_Custcode.Text & "'  and create_date >= to_date('" & Me.txt_ValidFrom.Text & "', 'DD.MM.YYYY') and create_date <= to_date('" & Me.txt_ValidTo.Text & "', 'DD.MM.YYYY')+1  and lff.processed = 'Y' order by create_date desc"
            Else
                sql &= " and lff.custcode = '" & Me.txt_Custcode.Text & "'  and lff.processed = 'Y' order by create_date desc"
            End If

        Else
            sql &= " and create_date >= to_date('" & Me.txt_ValidFrom.Text & "', 'DD.MM.YYYY') and create_date <= to_date('" & Me.txt_ValidTo.Text & "', 'DD.MM.YYYY')+1  and lff.processed = 'Y' order by create_date desc"
        End If
        'LOGLAMA
        'dt = persistent.myDBConn.myORATable(sql)
        dt = persistent.myDBConn.myORATable_LOG(sql, Me.txt_Custcode.Text, "", "", "", "select(Doldur)", "LineFreezePenaltyReport", Session("user").ToString())

        If dt.Rows.Count > 0 Then
            Dgall.DataSource = dt
            Dgall.DataBind()
        Else
            Dgall.DataSource = Nothing
            Dgall.DataBind()
            Alert("Uygun kayit bulunamadi.!!!", Me.Page)
        End If
    End Sub
    Private Sub InitializeComponent()

    End Sub
End Class
